﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web; 
using Exhibition.Common;
using Exhibition.Service;

namespace YXQ.Manager.Handler
{
    /// <summary>
    /// AdminHandler 的摘要说明
    /// </summary>
    public class AdminHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            AJAXJson rtnMessage = new AJAXJson();
            string opType = context.Request["OpType"];
            var controler = new ControlService(context);
            string msg = string.Empty;
            //string rtnMessage = string.Empty;
            //bool flg = false;
            if (!string.IsNullOrEmpty(opType))
            {
                switch (opType.ToLower())
                {
                    case "chklogin":  
                        rtnMessage.ResultMessage= controler.UserLogin();
                        break; 
                    case "gettopreg":
                        rtnMessage.ResultMessage = controler.GetTopReg();
                        break;
                    case "getarea":
                        rtnMessage.ResultMessage = controler.GetArea();
                        break;

                    default: break;
                }
            }
            context.Response.ContentType = "text/json;charset=UTF-8;";
            context.Response.Write(rtnMessage.ResultMessage);
            
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}